package cn.biplam.front.component.view.mdManage.buffer2md.main;

import cn.biplam.common.client.DataFilter;
import cn.biplam.common.client.Operator;
import cn.biplam.common.client.OperatorResult;
import cn.biplam.common.opcode.sqlengine.DDLParserCode.BufCompTabCode;
import cn.biplam.common.struc.MdStruc;
import cn.biplam.common.tools.TOOLS;
import cn.biplam.common.wrapper.ErrorMessage;
import cn.biplam.front.component.AjxResponse;
import cn.biplam.front.component.data.common.CaptionComp;
import cn.biplam.front.html.HtmlDiv;
import cn.biplam.front.html.base.HtmlWindow;
import cn.biplam.front.html.base.Const.Length_Unit;
import cn.biplam.front.template.control.FlatTable;

/**
 * 缓冲区表说明
 * @author WangSong 2009-7-2下午08:02:53
 * @version 1.0
 */
public class BufferTableDetail extends AjxResponse{
	
	public static final String cId = "2209";
	public static final String aId = "220901";
	
	private String width="300";
	private String height="150";
	@Override
	protected HtmlWindow ajxGet() throws ErrorMessage {
		return get();
	}
	
	private HtmlWindow get() throws ErrorMessage{
		HtmlWindow bufferTable = new HtmlDiv();
		DataFilter filter=new DataFilter();
		filter.put(MdStruc.ImpCompTabStruc.CTID,recordId);
		OperatorResult or=Operator.get(BufCompTabCode.Get_By_ID, mUser.getUserID(), filter);
		String tableName = "";
		String tableCname = "";
		String tableDesc = "";
		
		if(TOOLS.exist(or)){
			tableName = or.getValue(MdStruc.ImpCompTabStruc.IMP_TABLE_NAME);
			tableCname = or.getValue(MdStruc.ImpCompTabStruc.IMP_TABLE_CNAME);
			tableDesc = or.getValue(MdStruc.ImpCompTabStruc.IMP_TABLE_DESC);
			
			FlatTable ft = new FlatTable(cId,"");
			/**物理名称*/
			ft.putTh(CaptionComp.get(mUser,"16"), 0, 0);
			ft.setColWidth(0, "20",Length_Unit.percent);
			ft.putTd(tableName, 0, 1);
			/**逻辑名称*/
			ft.putTh(CaptionComp.get(mUser,"265"), 1, 0);
			ft.putTd(tableCname, 1,1);
			/**说明*/
			ft.putTh(CaptionComp.get(mUser,"10"), 2, 0);
			ft.putTd(tableDesc, 2,1);
		
			bufferTable.put(ft.get());
			if(ft.getHeight()!=null){
				height = ft.getHeight();
			}
		}
		bufferTable.setStyleWidth(width);
		bufferTable.setStyleHeight(height);
		return bufferTable;
	}

}
